Processors are used in an ever expanding array of devices. For example, high end processors are found in a variety of computing devices, including servers, personal computers and personal digital assistants (PDAs). Processors are also found in other electronic devices such as communication devices, media players and gaming devices. Increasingly, processors are found in peripherals such as printers, scanners and monitors. In all these cases the processor performs a variety of processing functions to implement the device.
As the use of processors increases one progressively more important issue is the ability to monitor and evaluate the performance of the processor. To accomplish this, performance monitors are commonly included in modem high-performance processors. The performance monitors provide the ability to evaluate the performance of the processor. As one example, the performance monitors provide the ability to characterize the operation of the processor by counting the number of selected events that occur during a time period. The events that are counted can include a wide variety of different operations, such as instructions executed, memory reads and cache misses. By providing a mechanism for counting these events over a time period, the performance monitor provides the ability to characterize the performance of the processor. This can then be used to optimize the system, for example, by optimizing the performance of software designed to be executed by the processor.
Additionally, hardware performance monitors provide the ability to measure performance of the system without requiring the modification of existing software application being tested. This is particularly important in many embedded applications where the software application is loaded into a non-volatile memory. In these cases modifying the software application for performance analysis would be very cumbersome, or in the case of a read-only memory, impossible.
One issue with current performance monitors is the lack of control provided over the time period in which events are counted. In typical performance monitors the counting is started and stopped explicitly. For example, the performance monitor is started by setting a selected bit field visible to a monitoring program. Requiring that counting be explicitly started and stopped provides only coarse control of the events being counted. This coarse resolution of control limits the effectiveness of the performance monitor in evaluating the system and thus limits the ability to fully optimize the operation of the system.
Specifically, such a coarse resolution of control limits the ability of the performance monitor to be used on specific windows of interest in the code. In a typical performance analysis process, it can be desirable to perform repeated executions of particular code portions. For example, the repeated executions of code could be those portions of code which are most frequently used and thus contribute greatly to the overall performance of the system. As the process is refined, these windows of interest are generally made smaller as “hot spots” in the code are located. Past performance monitors with limited control have been unable to provide effective performance monitoring that focuses on specific portions of code, and thus have had limited effectiveness in optimizing the operation of the system.